<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="js/jquery-3.2.1.min.js" ></script>
	</head>
	<body>
    	<script>
    		//JSON数据格式
    	
    		var head={'name':'laet','key':'value'};
    		var leat=[1,2,3,4];
    		var key=['张三','李四','王五','赵六'];
    		var tob={'name':['张三','李四','王五','赵六'],'key':'value'};
    		
    		for(var i in head){
    			document.write('第'+i+'个,是:');
    			document.write(head[i]);
    			document.write('<br />');
    		}
    		
    		for(var i in leat){
    			document.write('第'+i+'个,是:');
    			document.write(leat[i]);
    			document.write('<br />');
    		}
    		
    		for(var i in key){
    			document.write('第'+i+'个,是:');
				document.write(key[i]);
				document.write('<br />');
    		}
			
			for(var i in tob){
				document.write('第'+i+'个,是:');
				document.write(tob[i]);
				document.write('<br />')
			}
		
			//方法的定义
			
			//无参数方法
			function m1(){
				document.write('this is m1');
				document.write('<br />');
			}
			//有参数方法
			function m2(a){
				document.write("this is m2: "+a);
				document.write('<br />');
			}
			//多个参数的方法
			function m3(a,b,c,d){
				document.write('this is m3: '+a);
				document.write("this is m3: "+b);
				document.write("this is m3: "+c);
				document.write("this is m3: "+c+a);
				document.write("this is m3: "+a+b);
				document.write("this is m3: "+d);
				document.write("this is m3: "+a+d);// 从左到右 顺序计算
				document.write("this is m3: "+(b+d));// 通过()来 优先计算 再进行 连接
				document.write("<br>");
			}
			
			//有参数方法+有返回值
			function m4(a){
				return a*3.14;//方法得当返回值
			}
			
			//方法的调用；从上到下
			m1();
			m2(1);
			m2('abc');
			
			m3(23,true,'abcd'); 
			m3(23,true,'abcd',45);
			
			document.write(m4(45)+'<br />');
			var res = m4(45);
			document.write(m4(45)+'<br />')
             /*
              * 关键字 方法名(参数列表多个参数用逗号隔开){方法内容的开始和结束}
              * 方法的调用：
              * 	方法名(参数);
              * 	对象.方法名(参数)；
              * var res=方法名1(参数)
              * var res2=方法名2(res);
              *   var 变量名=值；
             */
            
    	</script>
	</body>
</html>
